home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / amigaoscd / amigapluscd / AP-Website / links / admin / delete_category.php < prev    next >
PHP Script  |  2001-07-22  |  2KB  |  89 lines

  1. <?
  2. // *******************************************************************
  3. //  admin/delete_category.php
  4. // *******************************************************************
  5.  
  6. include("../include/config.php");
  7. include("../include/functions.php");
  8. include("../include/lang/$language.php");
  9.  
  10. include("../include/session.php");
  11. session_start();
  12. ?>
  13. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  14. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  15. <html>
  16. <head>
  17. <title></title>
  18. <link rel = "stylesheet" type = "text/css" href = "style.css" />
  19. </head><?
  20.     echo "<META NAME=\"REFRESH\" HTTP-EQUIV=\"REFRESH\" ";
  21.     echo "content=\"2; URL=categories_main.php?" . session_name() . "=";
  22.     echo session_id() . "&RPID=" . $RPID . "\">";
  23. ?>
  24. <?=$adm_body?>
  25. <table cellspacing="0" cellpadding="5" border="1" align="center" width="100%">
  26. <tr>
  27.     <td align="center" class="theader"><?
  28.     
  29.         if(isset($ID)){
  30.             
  31.             $get_cat = sql_query("
  32.                 select
  33.                     *
  34.                 from
  35.                     $tb_categories
  36.                 where
  37.                     ID='$ID'
  38.             ");
  39.  
  40.             $get_row = sql_fetch_array($get_cat);
  41.             
  42.             $check_for_child = sql_query("
  43.                 select
  44.                     *
  45.                 from
  46.                     $tb_categories
  47.                 where
  48.                     PID='$get_row[ID]'
  49.             ");
  50.  
  51.             $count_parent_row = sql_num_rows($check_for_child);
  52.  
  53.             if($count_parent_row > 0){
  54.                 
  55.                 echo "<br />Cannot delete " . $get_row[Category];
  56.                 echo ", you must<br>delete it's subcategories first.<br /><br />";
  57.                 echo "<a href=\"categories.php?" . session_name() . "=";
  58.                 echo session_id() . "&RPID=" . $RPID;
  59.                 echo "\">Click here to continue</a><br /><br />";
  60.             } else {
  61.  
  62.                 if(
  63.                     $delete = sql_query("
  64.                         delete from
  65.                             $tb_categories
  66.                         where
  67.                             ID='$ID'
  68.                     ")
  69.                 ){
  70.                     echo "<br />Category " . $get_row[Category];
  71.                     echo " has been deleted.<br /><br />";
  72.                     echo "<a href=\"categories_main.php?" . session_name() . "=";
  73.                     echo session_id() . "&RPID=" . $RPID;
  74.                     echo "\">Click here to continue</a><br /><br />";
  75.                 } else {
  76.                     echo "<br />Could not delete " . $get_row[Category];
  77.                     echo ",<br />it doesn't exist.<br><br>";
  78.                     echo "<a href=\"categories.php?" . session_name() . "=";
  79.                     echo session_id() . "&RPID=" . $RPID;
  80.                     echo "\">Click here to continue</a><br />";
  81.                 }
  82.             }
  83.         }
  84.         ?></td>
  85.     </tr>
  86.     </table>
  87. </body>
  88. </html>
  89.